From: Florian Müllner Date: Wed, 1 Nov 2017 18:21:31 +0000 (+0100) Subject: messageTray: Split out policy creation X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~897^2^2~145 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8f15193b4;p=gnome-shell.git messageTray: Split out policy creation The _createPolicy() method of a subclass usually depends on some constructor parameters that need to be set before chaining up to the parent. This works fine with Lang.Class, but will break with ES6 classes, as "this" is only initialized after chaining up. Prepare for this by not creating the policy in the constructor, but when it is first accessed. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/350 --- diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index fc4e00c9d..7ce977f47 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -701,7 +701,13 @@ var Source = new Lang.Class({ this.notifications = []; - this.policy = this._createPolicy(); + this._policy = null; + }, + + get policy() { + if (!this._policy) + this._policy = this._createPolicy(); + return this._policy; }, get count() {